import request from '@/utils/request'

// 查询应用权限列表
export function getPermissions(query) {
  return request({
    url: '/gatewayadmin/permission/list',
    method: 'get',
    params: query
  })
}

// 查询应用权限详细
export function getRouter(uuid) {
  return request({
    url: '/gatewayadmin/permission/' + uuid,
    method: 'get'
  })
}


// 新增应用权限
export function savePermissions(data) {
  return request({
    url: '/gatewayadmin/permission',
    method: 'post',
    data: data
  })
}// 批量增加应用权限
export function patchAdd(data) {
  return request({
    url: '/gatewayadmin/permission/patchAdd',
    method: 'post',
    data: data
  })
}

// 修改应用权限
export function updateRouter(data) {
  return request({
    url: '/gatewayadmin/permission',
    method: 'put',
    data: data
  })
}

// 删除应用权限
export function delRouter(uuid) {
  return request({
    url: '/gatewayadmin/permission/' + uuid,
    method: 'delete'
  })
}
//保存
export function deleteByid(uuid) {
  return request({
    url: '/gatewayadmin/permission/' + uuid,
    method: 'delete'
  })
}

// 获取指定应用的路由权限
export function getRouterByAppid(appid) {
  return request({
    url: `/gatewayadmin/permission/ByAppId/${appid}`,
    method: 'get'
  })
}
